//
//  NNGuideViewController.swift
//  CommonTool
//
//  Created by tenroadshow on 12.1.22.
//

import UIKit

class NNGuideViewController: NNBaseViewController {

    lazy var titleLabel1: UILabel = {
        let label = UILabel(frame: CGRect(x: 100, y: 200, width: 130, height: 50))
        label.text = "红色"
        label.backgroundColor = .red
        return label
    }()
    
    lazy var titleLabel2: UILabel = {
        let label = UILabel(frame: CGRect(x: 10, y: 220, width: 80, height: 80))
        label.text = "黄色黄色"
        label.backgroundColor = .yellow
        return label
    }()

    lazy var titleLabel3: UILabel = {
        let label = UILabel(frame: CGRect(x: 50, y: 300, width: 100, height: 50))
        label.text = "123123123"
        label.backgroundColor = .orange
        return label
    }()

    lazy var titleLabel4: UILabel = {
        let label = UILabel(frame: CGRect(x: 300, y: 320, width: 30, height: 30))
        label.text = "哈哈哈负担"
        label.backgroundColor = .purple
        return label
    }()

    override func viewDidLoad() {
        super.viewDidLoad()
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "显示",
                                                            style: .plain,
                                                            target: self,
                                                            action: #selector(nextAction))

        view.backgroundColor = .lightText
        title = "新安装引导"
        
        view.addSubview(titleLabel1)
        view.addSubview(titleLabel2)
        view.addSubview(titleLabel3)
        view.addSubview(titleLabel4)
    }
    
    
    @objc func nextAction() {
        var shareItem = NNGuideItem()
        shareItem.message = "点击这里可以进行分享哦~"
        shareItem.direction = .topLeft
        
        var segmentItem = NNGuideItem()
        segmentItem.message = "点击这里切换内容展示"
        segmentItem.direction = .topLeft

        var barItem = NNGuideItem()
        barItem.message = "赶紧报名参会吧~"
        barItem.direction = .bottomLeft

        
        let items: [(UIView, NNGuideItem)] =
        [(titleLabel1, shareItem),
                     (titleLabel2, segmentItem),
                     (titleLabel3, barItem)]
        
        let guideView = NNGuideView()
        guideView.shouldOnlyWhereTouched = true
        guideView.showGuide(by: items)
        NNGuideManager.recordShowed(type: .detailPage)

    }
}
